#include <iostream>
#include <pthread.h>
#include <unistd.h>
#include <sys/types.h>

using namespace std;

void *newthreadrun(void *args)
{
    while (true)
    {
        cout << "i am new thread,pid:"<<getpid() << endl;

        sleep(1);
    }
}

int main()
{
    pthread_t tid;
    pthread_create(&tid, nullptr, newthreadrun, nullptr);
    while (true)
    {
        cout << "i am main thread,pid:"<<getpid() << endl;
        sleep(1);
    }
    return 0;
}